﻿using OSMLib;

namespace osmGetter
{
    class Program
    {
        static void Main(string[] args)
        {
            //http://www.openstreetmap.org/#

            // string szFile = @"c:\osm.xml";

            // osmLoader.FromFile( szFile);
            //GET /api/0.5/map?bbox=left,bottom,right,top
            //0.25 degrees of latitude or longitude

            // osmLoader.FromCache(o);
            // return;

            //51.8 Sarrrfff

            // added whenI found that careful, small .02 tiles missed some features.
            //OsmCache.AdHoc("borderWithVietnamNogood.txt", 106.48, 16.4, 106.88, 16.64);
            // turned out that a laos - vietnam border is missing a laos border  key value

            //3
            for (double lat = 21.0; lat < 22.6; lat += 0.02)
            {
                for (double lon = 101; lon < 103.1; lon += 0.02)
                {
                    OsmCache.FromURL(lat, lon);
                }
            }

            //5
            for (double lat = 19.0; lat < 21; lat += 0.02)
            {
                for (double lon = 100; lon < 101; lon += 0.02)
                {
                    OsmCache.FromURL(lat, lon);
                }
            }


            //7
            for (double lat = 17.9; lat < 19; lat += 0.02)
            {
                for (double lon = 103; lon < 105.7; lon += 0.02)
                {
                    OsmCache.FromURL(lat, lon);
                }
            }



            //9
            for (double lat = 13.8; lat < 16; lat += 0.02)
            {
                for (double lon = 105; lon < 107.8; lon += 0.02)
                {
                    OsmCache.FromURL(lat, lon);
                }
            }

            //8
            for (double lat = 16; lat < 17.9; lat += 0.02)
            {
                for (double lon = 104; lon < 107.5; lon += 0.02)
                {
                    OsmCache.FromURL(lat, lon);
                }
            }


            //2
            for (double lat = 19.0; lat < 21.0; lat += 0.02)
            {
                for (double lon = 103; lon < 105; lon += 0.02)
                {
                    OsmCache.FromURL(lat, lon);
                }
            }



            //6 done
            for (double lat = 17.4; lat < 19; lat += 0.02)
            {
                for (double lon = 100.9; lon < 103; lon += 0.02)
                {
                    OsmCache.FromURL(lat, lon);
                }
            }

            //1 done
            for (double lat = 19.0; lat < 21.0; lat += 0.02)
            {
                for (double lon = 101; lon < 103; lon += 0.02)
                {
                    OsmCache.FromURL(lat, lon);
                }
            }

            //4 done
            for (double lat = 21.0; lat < 21.5; lat += 0.02)
            {
                for (double lon = 100.5; lon < 101; lon += 0.02)
                {
                    OsmCache.FromURL(lat, lon);
                }
            }


        }
    }
}
